@extends('admin.main')

@section('body')
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>行为日志</h2>
    </div>

    <div>
        <button class="btn ajax-get confirm" url="{{urlAdmin('action','getClear')}}">清 空</button>
        <button class="btn ajax-post confirm" target-form="ids" url="{{urlAdmin('action','anyRemove')}}">删 除</button>
    </div>
    <!-- 数据列表 -->
    <div class="data-table">
        <table class="">
            <thead>
            <tr>
                <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                <th class="">编号</th>
                <th class="">行为名称</th>
                <th class="">执行者</th>
                <th class="">执行时间</th>
                <th class="">操作</th>
            </tr>
            </thead>
            <tbody>
            @if(count($rows['data']))
                @foreach($rows['data'] as $v)
                    <tr>
                        <td><input class="ids" type="checkbox" name="ids[]" value="{{$v['id']}}"/></td>
                        <td>{{$v['id']}}</td>
                        <td>{{$v['action']['title']}}</td>
                        <td>{{$v['admin']['nickname']}}</td>
                        <td><span>{{date('Y-m-d H:i:s',$v['create_time'])}}</span></td>
                        <td><a href="{{urlAdmin('action','getShowLog',['id'=>$v['id']])}}">详细</a>
                            <a class="confirm ajax-get" href="{{urlAdmin('action','anyRemove',['ids'=>$v['id']])}}">删除</a>
                        </td>
                    </tr>
                @endforeach
            @else
                <td colspan="6" class="text-center"> aOh! 暂时还没有内容!</td>
            @endif
            </tbody>
        </table>
    </div>
    <!-- 分页 -->
    <div class="page">
        @if($rows['last_page']>1)
            <div>
                @if($rows['prev_page_url'])
                    <a class="prev" href="{{$rows['prev_page_url']}}">&lt;&lt;</a>
                @endif
                @if(count($rows['pageNoList']))
                    @foreach($rows['pageNoList'] as $v)
                        @if($rows['current_page'] == $v)
                            <span class="current">{{$v}}</span>
                        @else
                            <a class="num" href="{{urlAdmin('action','getLog',['page'=>$v])}}">{{$v}}</a>
                        @endif
                    @endforeach
                @endif
                @if($rows['next_page_url'])
                    <a class="next" href="{{$rows['next_page_url']}}">&gt;&gt;</a>
                @endif
                <span class="rows">共 {{$rows['total']}} 条记录</span>
            </div>
        @endif
    </div>
    <!-- /分页 -->

@endsection

@section('script')
    <script type="text/javascript">
        $(function () {
            $("#action_add").click(function () {
                window.location.href = $(this).attr('url');
            })
        })
    </script>
@endsection
